package com.share.cloudStorage.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: javaKing
 * @Date: 2024/12/09/14:54
 * @Description:
 */
@Configuration
public class CorsConfig implements WebMvcConfigurer {
    //配置跨域请求
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedOriginPatterns("*").allowedMethods("*").
                allowedHeaders("*").exposedHeaders("*").allowCredentials(true).maxAge(3600);
    }
}
